'''
Created on 09.04.2014

@author: Jan-Patrick
'''

import pygame

class Obstacle(object):
    global screen

    def __init__(self, x, y, leben, id):
        self.X = x
        self.Y = y
        self.Leben = leben
        self.ID = id
        
        # Call the parent class (Sprite) constructor
        pygame.sprite.Sprite.__init__(self)
        # Load the image
        self.image = pygame.image.load("ball.png").convert()
        # Set our transparent color
        self.image.set_colorkey((255,255,255))
        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y
        
    x = 0
    y = 0
    leben = 0
    id = 0

    def hitEvent(self, id, schaden):
        self.ID = id
        self.Schaden = schaden
        
        
    def addObstacles(self, x, y, anzahl, leben, startid):
        print "--------------------"
        print "Creating " + str(anzahl) + " Enemies"
        print "--------------------"
        print ""
        Obstacles = [Obstacle(10,10,100,10*i,i,i) for i in range(anzahl)]  
        for i in range(anzahl):
            Obstacles[i].id = startid + i
            Obstacles[i].x = x
            Obstacles[i].y = y
            Obstacles[i].leben = leben
            if i == anzahl-1:
                print "All Obstacles been created!"
                print ""
        
        print "--------------------"
        print "Listing the Obstacles"
        print "--------------------"
        print ""    
        
        for i in range(anzahl):
            'showObstacles(self,i)'
            print "Informations about Obstacle No. " + str(i)
            print "ID: " + str(Obstacles[i].id)
            print "Health: " + str(Obstacles[i].leben)       
            print "Position: " + str(Obstacles[i].x) + "|" + str(Obstacles[i].y)
            print ""
            if i == anzahl-1:
                print "All Obstacles been listed!"
                print ""        